package be.kuleuven.cs.mop.domain.model.impl;


import static org.junit.Assert.*;

import org.junit.*;

import be.kuleuven.cs.mop.TestEnvironment;
import be.kuleuven.cs.mop.domain.exceptions.TaskManagerException;



public class FieldTest {
	
	private static final TestEnvironment ENV = TestEnvironment.newInstance();
	
	
	
	public void setUp(){
		
	}
	
	@Test
	public void testConstructorLegalCase1(){
		Integer randInt = 3;
		try{
			new Field(FieldType.NUMERICAL, randInt);
		}
		catch(Exception e){
			assertFalse(true);
		}
		
	}
	
	@Test
	public void testConstructorLegalCase2(){
		String randString = "MOP IS GEWELDIG";
		try{
			new Field(FieldType.TEXTUAL, randString);
		}
		catch(Exception e){
			assertFalse(true);
		}
		
	}
	
	@Test(expected=TaskManagerException.class)
	public void testConstructorIllegalCase1() throws TaskManagerException{
		String randString = "MOP IS GEWELDIG";
		new Field(FieldType.NUMERICAL, randString);
	}
	
	@Test(expected=TaskManagerException.class)
	public void testConstructorIllegalCase2() throws TaskManagerException{
		Integer randInt = null;
		new Field(FieldType.NUMERICAL, randInt);
	}
	
	@Test(expected=TaskManagerException.class)
	public void testConstructorIllegalCase3() throws TaskManagerException{
		Integer randInt = 5;
		new Field(null, randInt);
	}

	
	@Test
	public void testGetType(){
		assertEquals(ENV.field1.getType(),FieldType.TEXTUAL);
	}
	
	@Test
	public void testGetValue(){
		assertEquals((String)(ENV.field1.getValue()),"TaskManTask");
	}
	

	
	
}
